﻿Public Class resizingimage
    Public Shared New_Bitmap
    ''' <summary>
    ''' The height you want the resize bitmap to be in. The width is calucated by the aspet ratio.
    ''' </summary>
    ''' <param name="Height"></param>
    ''' The image to resize (bitmap).
    ''' <param name="ImageToResize"></param>
    ''' <returns></returns>
    Public Shared Function ResizeImage(Height As Integer, ImageToResize As Bitmap) As Image

        Try

            Dim Width As Double
            Dim aspectRatio As Double

            aspectRatio = ImageToResize.Width / ImageToResize.Height
            Width = Convert.ToDouble(Height * aspectRatio)
            Dim wi As Integer
            wi = Convert.ToInt32(Width)
            Dim hi As Integer
            hi = Convert.ToInt32(Height)
            New_Bitmap = New Bitmap(ImageToResize, wi, hi)

        Catch ex As Exception
        End Try
        Return New_Bitmap
    End Function

End Class
